<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		
		<table border="1" width="500px">
			
			<tr >
				<td colspan="3">
					<input type="button" value="删除" />
				</td>
			</tr>
			
			<tr>
				<td>
					<input type="checkbox" id="selectAll" />
				</td>
				<td>姓名</td>
				<td>年龄</td>
			</tr>
			
			<tr>
				<td>
					<input type="checkbox" class="zxx" />
				</td>
				<td>王超</td>
				<td>23</td>
			</tr>
			<tr>
				<td>
					<input type="checkbox"  class="zxx" />
				</td>
				<td>陈叶</td>
				<td>23</td>
			</tr>
			
			<tr>
				<td>
					<input type="checkbox" class="zxx" />
				</td>
				<td>石睿鑫</td>
				<td>20</td>
			</tr>
			
			
		</table>
		
		
	</body>
	
	<script type="text/javascript" src="../../js/jquery-1.7.2.js" ></script>
	
	<script>
	
		$(function(){
			$('#selectAll').click(function(){
				
				//1 先拿到所有的zxx
				var zxxs= $('.zxx');
				//console.log(zxxs.length);
				
				
				var xyz =$("#selectAll").attr("checked");
				
				
				zxxs.each(function(index,data){
					// this js对象  $(this) jqury
					
					//this.checked=true;
					
					//重点：如何把jQuery对象转化成js对象    sha  sha[0]
					//var sha= $(this);
					//sha[0].checked=true;
					
					//<input type="checkbox" checked="checked" class="zxx" />  $(this)
					//$(this).attr("checked","checked");
					
					//判断是否选中
					var b =$(this).attr("checked");
					
					//$(this).attr("checked",xyz==undefined?false:true);
					$(this).attr("checked",$("#selectAll")[0].checked);
					
					/*if(xyz=="checked"){
						//
						$(this).attr("checked","checked");
					}else{
						//alert("false");
						$(this).attr("checked",false);
					}*/
				});
			});
			
		});
	
		//0把全选的功能实现
		
		
		//1 获得哪些行被选中...  如果1个也没有选  提示 请最少选中1行
		
		
		
		//2删除被选中的行
		
	</script>
</html>
